<template>
    <view class="cotainer">
        <view class="logo-area">
            <view class="logo">
                <image class="logo_img" src="@/static/logo.png" />
            </view>
        </view>
        <view class="phone">
            <text>手机名</text>
            <input type="text" v-model.trim="phone" placeholder="请输入手机号" />
        </view>
        <view class="password">
            <text>密码：</text>
            <input type="password"  v-model.trim="pwd" placeholder="请输入密码" />
        </view>
        <view class="btn">
            <button @click="login">登录</button>
        </view>
    </view>
</template>

<script>
import HbbRequest, {GET_LOGIN,GET_LOGIN_USER_COMPANY,GET_BASE_URL} from "@/api/api";
import PageBaseMixin from "@/common/script/mixins/PageBase.mixin";
export default {
    mixins: [PageBaseMixin(true)],
    data(){
        return{
            phone:'15692018499',
            pwd:'lmw5201314',
            logoImg:'',
        }
    },
    onLoad(){
        uni.hideTabBar();
    },
    methods:{
        login(){
            if(this.phone && this.pwd){
                const res = new HbbRequest(GET_LOGIN,{
                    "tableData": [{
                        "EntID": "0",
                        "UserID":   "0",
                        "AppID":   "@AppID",
                        "Secret":   "@Secret",
                        "BSN":   "@BSN",
                        "AreaNo": "86",
                        "Phone":   this.phone,            
                        "PWD":   this.pwd,
                    }]
                }).send();
                res.then(data => {
                    console.log(data.data);
                    if(data.data.table1){
                        const res1 = new HbbRequest(GET_LOGIN_USER_COMPANY,{
                            "tableData": [{
                                'EntID':data.data.table1[0].EntID,
                                'UserID':data.data.table1[0].UserID,
                                "AppID": "@AppID",
                                "Secret": "@Secret",
                                "BSN": "@BSN",
                                "AreaNo": "86",
                                "Phone": this.phone,
                                "PWD": this.pwd,
                                "AppName": "HBB_DMS_Android",
                                "SoftwareType": "DMS"
                            }]
                        }).send();
                        res1.then(data1=>{
                            console.log(data1);
                            uni.switchTab({
                                url:"/pages/index/index"
                            })
                        })
                    }
                });
            }
        },
        // async login (){

        // },
    },
}
</script>

<style >
.cotainer{
    position: relative;
    width: 100%;
    min-height: 547px;
    background: #f5f5f5;
}
.logo-area{
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 300rpx;
}
.logo{
    position: relative;
    width: 176rpx;
    height: 176rpx;
    border-radius: 50%;
    overflow: hidden;
}
.logo_img{
    width: 100%;
}
.phone{
    width: 100%;
    background: #fff;
    display: flex;
    font-size: 16px;
    align-items: center;
    height: 40px;
}
.phone text{
    width: 80px;
    /* height: 30px; */
    line-height: 40px;
    text-align: center;
    /* background-color: red; */
    color: #333;
}
.phone input{
    color: #858585;
}

.password{
    width: 100%;
    background: #fff;
    display: flex;
    font-size: 16px;
    align-items: center;
    height: 40px;
    margin-top: 10px;
}
.password text{
    width: 80px;
    /* height: 30px; */
    line-height: 40px;
    text-align: center;
    /* background-color: red; */
    color: #333;
}
.password input{
    color: #858585;
}

.btn{
    padding: 10px;

}
.btn button{
    width: 340px;
    height: 38px;
    line-height: 38px;
    color: white;
    background: #c4c4c4;
    border: none;
    font-size: 16px;
}
</style>